package com.norbitltd.guavaleaves.java.lang;

import com.google.common.base.Predicate;

public class ObjectPredicates {

	public static Predicate<Object> isEqual(final Object o) {
		return new Predicate<Object>() {
			public boolean apply(Object arg0) {
				if (arg0 == null) {
					return o == null;
				} else {
					return arg0.equals(o);
				}
			}
		};
	}
	
	public static Predicate<Object> isNull() {
		return new Predicate<Object>() {
			public boolean apply(Object arg0) {
				return arg0 == null;
			}
		};
	}
	

	public static Predicate<Object> isNotNull() {
		return new Predicate<Object>() {
			public boolean apply(Object arg0) {
				return arg0 != null;
			}
		};
	}
}